package com.suredy.app.project.model;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.DateTimeFormat.ISO;

import com.suredy.core.model.BaseModel;

/**
 * 成本
 * 
 * @author VIVID.G
 * @since 2015-7-30
 * @version v0.1
 */
@Entity
@Table(name = "tb_project_cost")
public class ProjectCost extends BaseModel {

	private static final long serialVersionUID = 1L;

	/* 支付名称 */
	@Column(length = 100, nullable = false)
	private String name;

	/* 支付金额 */
	@Column(nullable = false, columnDefinition = "float(255,2) default 0.00")
	private Float pay;

	/* 支付时间 */
	@Column(nullable = false)
	@DateTimeFormat(iso = ISO.DATE)
	private Date payTime;

	/* 收款人/单位 */
	@Column(length = 200)
	private String payTo;

	/* 备注 */
	@Column(length = 500)
	private String des;

	/* 是否到账 */
	@Column(nullable = false, columnDefinition = "int default 1")
	private Boolean payed;

	/* 关联的项目信息 */
	@ManyToOne(cascade = CascadeType.REFRESH, fetch = FetchType.LAZY)
	@JoinColumn(name = "project_id")
	private Project project;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Float getPay() {
		return pay;
	}

	public void setPay(Float pay) {
		this.pay = pay;
	}

	public Date getPayTime() {
		return payTime;
	}

	public void setPayTime(Date payTime) {
		this.payTime = payTime;
	}

	public String getPayTo() {
		return payTo;
	}

	public void setPayTo(String payTo) {
		this.payTo = payTo;
	}

	public String getDes() {
		return des;
	}

	public void setDes(String des) {
		this.des = des;
	}

	public Boolean getPayed() {
		return payed;
	}

	public void setPayed(Boolean payed) {
		this.payed = payed;
	}

	public Project getProject() {
		return project;
	}

	public void setProject(Project project) {
		this.project = project;
	}

}
